<template>
  <div class="weui-panel weui-panel_access mycard">
    <div class="weui-panel__bd">
      <a href="javascript:void(0);" class="weui-media-box weui-media-box_appmsg odinfowrap">
        <div class="weui-media-box__bd">
          <h4 class="weui-media-box__title odinfotitle">
            <img :src="typeiconsrc" :srcset="typeiconsrcset">
            <span>{{order_detail.createByUserObj.name}} · {{order_detail.createByUserObj.deptNames}}</span>
          </h4>
          <h4 class="weui-media-box__title odinfoaddr">{{this.cm.getBuildingStr(order_detail.buildingId) + order_detail.address}}</h4>
          <a :href="'tel:' + order_detail.createByUserObj.mobile" class="odinfophone">{{order_detail.createByUserObj.mobile}} <span class="iconfont">&#xe792;</span></a>
        </div>
        <div class="weui-media-box__hd">
          <img class="weui-media-box__thumb" :src="txsrc" alt="">
        </div>
      </a>
    </div>
    <div class="weui-panel__ft">
      <div class="weui-cell weui-cell_access weui-cell_link odinfowrap2">
        <p class="weui-media-box__desc">{{order_detail.desc}}</p>
        <div class="odinfoImgsWrap">
          <my-attachments :attachments="attach" :attachtype="'0'"></my-attachments>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import MyAttachments from '@/components/myattachments'
import { mapState } from 'vuex'
export default {
  name: 'OdInfo',
  props: ['rtype', 'attach'],
  components: {
    MyAttachments
  },
  data () {
    return {
      typeiconsrc: '',
      typeiconsrcset: ''
    }
  },
  computed: {
    ...mapState(['order_detail']),
    txsrc () {
      return this.cm.getAvatar(this.order_detail.createByUserObj.avatarUrl)
    }
  },
  mounted () {
    let cstr = this.cm.getCategoryStr(this.rtype)
    let imgs = this.cm.getCategoryImg(cstr)
    this.typeiconsrc = imgs.imgsrc
    this.typeiconsrcset = imgs.imgsrcset
  }
}
</script>

<style lang="stylus" scoped>
.odinfoImgsWrap >>> .uploadPreviewWrap
  padding-left 0
.odinfowrap
  align-items stretch
  .odinfotitle
    font-size 14px
    color #9b9b9b
  .odinfoaddr
    font-size .48rem
    line-height .76rem
    margin-top .1rem
    white-space normal
  .odinfophone
    font-size 14px
    font-family PingFangSC-Regular
    height .4rem
    line-height .4rem
    color #9b9b9b
    display flex
    margin-top .16rem
    .iconfont
      font-size 14px
      color #576b95
      margin-left .5em
  .weui-media-box__hd
    margin-right 0
.weui-media-box__desc
  line-height 1.8em

.odinfowrap2
  display block
  padding-bottom .3rem
  .odinfoImgsWrap
    margin-top .2rem
</style>
